Identification and verification of a sector within a block of mass STO rage flash memory

ABSTRACT

A method and apparatus is disclosed for identifying a block being stored within flash memory devices using a cluster address for each block, the block being selectively erasable and having one or more sectors, the cluster address being stored in one of the sectors of the block. In an alternative embodiment, the cluster address is stored in at least two different sectors within the same block for ensuring that the information last written to the block is valid. Further disclosed is a novel way to use a defect flag for each block stored within the flash memory device for efficiently identifying non-defective blocks upon system power-up.

CROSS REFERENCE TO RELATED APPLICATION

This application is a continuation of application Ser. No. 09/156951,filed Sep. 18, 1998, now U.S. Pat. No. 6,128,695, issued Oct. 3, 2000,entitled “IDENTIFICATION AND VERIFICATION OF A SECTOR WITHIN A BLOCK OFMASS STORAGE FLASH MEMORY” which is a continuation of application Ser.No. 08/858,847 filed May 19, 1997, now prior U.S. Pat. No. 5,838,614,issued on Nov. 17, 1998, entitled “IDENTIFICATION AND VERIFICATION OF ASECTOR WITHIN A BLOCK OF MASS STORAGE FLASH MEMORY” which is acontinuation-in-part of application Ser. No. 08/831,266 filed Mar. 31,1997, now prior U.S. Pat. No. 5,907,856, issued on May 25, 1999,entitled “MOVING SECTORS WITHIN A BLOCK OF INFORMATION IN A FLASH MEMORYMASS STORAGE ARCHITECTURE”, which is a Continuation-in-Part ofapplication Ser. No. 08/509,706 filed Jul. 31, 1995 now prior U.S. Pat.No. 5,845,313, issued on Dec. 1, 1998, and entitled “DIRECT LOGICALBLOCK ADDRESSING FLASH MEMORY MASS STORAGE ARCHITECTURE.”

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention relates to the field of mass storage for computers. Moreparticularly, this invention relates to an architecture for replacing ahard disk with a semiconductor nonvolatile memory and in particularflash memory.

2. Description of the Prior Art

Computers conventionally use rotating magnetic media for mass storage ofdocuments, data, programs and information. Though widely used andcommonly accepted, such hard disk drives suffer from a variety ofdeficiencies. Because of the rotation of the disk, there is an inherentlatency in extracting information from a hard disk drive.

Other problems are especially dramatic in portable computers. Inparticular, hard disks are unable to withstand many of the kinds ofphysical shock that a portable computer will likely sustain. Further,the motor for rotating the disk consumes significant amounts of powerdecreasing the battery life for portable computers.

Solid state memory is an ideal choice for replacing a hard disk drivefor mass storage because it can resolve the problems cited above.Potential solutions have been proposed for replacing a bard disk drivewith a semiconductor memory. For such a system to be truly useful, thememory must be nonvolatile and alterable. The inventors have determinedthat FLASH memory is preferred for such a replacement.

FLASH memory is a transistor memory cell which is programmable throughhot electron, source injection, or tunneling, and erasable throughFowler-Nordheim tunneling. The programming and erasing of such a memorycell requires current to pass through the dielectric surroundingfloating gate electrode. Because of this, such types of memory have afinite number of erase-write cycles. Eventually, the dielectricdeteriorates. Manufacturers of FLASH cell devices specify the limit forthe number of erase-write cycles between 100,000 and 1,000,000.

One requirement for a semiconductor mass storage device to be successfulis that its use in lieu of a rotating media hard disk mass storagedevice be transparent to the designer and the user of a system usingsuch a device. In other words, the designer or user of a computerincorporating such a semiconductor mass storage device could simplyremove the hard disk and replace it with a semiconductor mass storagedevice. All presently available commercial software should operate on asystem employing such a semiconductor mass storage device without thenecessity of any modification.

SanDisk proposed an architecture for a semiconductor mass storage usingFLASH memory at the Silicon Valley PC Design Conference on Jul. 9, 1991.That mass storage system included read-write block sizes of 512 Bytes toconform with commercial hard disk sector sizes.

Earlier designs incorporated erase-before-write architectures. In thisprocess, in order to update a file on the media, if the physicallocation on the media was previously programmed, it has to be erasedbefore the new data can be reprogrammed.

This process would have a major deterioration on overall systemthroughput. When a host writes a new data file to the storage media, itprovides a logical block address to the peripheral storage deviceassociated with this data file. The storage device then translates thisgiven logical block address to an actual physical block address on themedia and performs the write operation. In magnetic hard disk drives,the new data can be written over the previous old data with nomodification to the media. Therefore, once the physical block address iscalculated from the given logical block address by the controller, itwill simply write the data file into that location. In solid statestorage, if the location associated with the calculated physical blockaddress was previously programmed, before this block can be reprogrammedwith the new data, it has to be erased. In one previous art, inerase-before-write architecture where the correlation between logicalblock address given by the host is one to one mapping with physicalblock address on the media. This method has many deficiencies. First, itintroduces a delay in performance due to the erase operation beforereprogramming the altered information. In solid state flash, erase is avery slow process.

Secondly, hard disk users typically store two types of information, oneis rarely modified and another which is frequently changed. For example,a commercial spread sheet or word processing software program stored ona user's system are rarely, if ever, changed. However, the spread sheetdata files or word processing documents are frequently changed. Thus,different sectors of a hard disk typically have dramatically differentusage in terms of the number of times the information stored thereon ischanged. While this disparity has no impact on a hard disk because ofits insensitivity to data changes, in a FLASH memory device, thisvariance can cause sections of the mass storage to wear out and beunusable significantly sooner than other sections of the mass storage.

In another architecture, the inventors previously proposed a solution tostore a table correlating the logical block address to the physicalblock address. The inventions relating to that solution are disclosed inU.S. Pat. No. 5,388,083, issued on Feb. 7, 1995 and U.S. Pat. No.5,479,638 issued on Dec. 26, 1995. The disclosures of these patentdocuments are incorporated herein by reference.

The inventors' previous solution discloses two primary algorithms and anassociated hardware architecture for a semiconductor mass storagedevice. It will be understood that “data file” in this patent documentrefers to any computer file including commercial software, user program,word processing software document, spread sheet file and the like. Thefirst algorithm in the previous solution provides means for avoiding anerase operation when writing a modified data file back onto the massstorage device. Instead, no erase is performed and the modified datafile is written onto an empty portion of the mass storage.

The semiconductor mass storage architecture has blocks sized to conformwith commercial hard disk sector sizes. The blocks are individuallyerasable. In one embodiment, the semiconductor mass storage can besubstituted for a rotating hard disk with no impact to the user, so thatsuch a substitution will be transparent. Means are provided for avoidingthe erase-before-write cycle each time information stored in the massstorage is changed.

According to the first algorithm, erase cycles are avoided byprogramming an altered data file into an empty block. This wouldordinarily not be possible when using conventional mass storage becausethe central processor and commercial software available in conventionalcomputer systems are not configured to track continually changingphysical locations of data files. The previous solution includes aprogrammable map to maintain a correlation between the logical addressand the physical address of the updated information files.

All the flags, and the table correlating the logical block address tothe physical block address are maintained within an array of CAM cells.The use of the CAM cells provides very rapid determination of thephysical address desired within the mass storage, generally within oneor two clock cycles. Unfortunately, as is well known, CAM cells requiremultiple transistors, typically six. Accordingly, an integrated circuitbuilt for a particular size memory using CAM storage for the tables andflags will need to be significantly larger than a circuit using othermeans for just storing the memory.

The inventors proposed another solution to this problem which isdisclosed in U.S. Pat. No. 5,485,595, issued on Jan. 16, 1996. Thedisclosure of this patent is incorporated herein by reference.

This additional previous solution invented by these same inventors isalso for a nonvolatile memory storage device. The device is alsoconfigured to avoid having to perform an erase-before-write each time adata file is changed by keeping a correlation between logical blockaddress and physical block address in a volatile space management RAM.Further, this invention avoids the overhead associated with CAM cellapproaches which require additional circuitry.

Like the solutions disclosed above by these same inventors, the deviceincludes circuitry for performing the two primary algorithms and anassociated hardware architecture for a semiconductor mass storagedevice. In addition, the CAM cell is avoided in this previous solutionby using RAM cells.

Reading is performed in this previous solutions by providing the logicalblock address to the memory storage. The system sequentially comparesthe stored logical block addresses until it finds a match. That datafile is then coupled to the digital system. Accordingly, the performanceoffered by this solution suffers because potentially all of the memorylocations must be searched and compared to the desired logical blockaddress before the physical location of the desired information can bedetermined.

Additionally, a solution was disclosed in a U.S. Pat. No. 5,907,856entitled “MOVING SECTORS WITHIN A BLOCK OF INFORMATION IN A FLASH MEMORYMASS STORAGE ARCHITECTURE”, issued on May 25, 1999 to Petro Estakhri,Berhanu Iman and Ali Ganjuei, to which this application is acontinuation-in-part. In the foregoing parent application, thedisclosure of which is herein incorporated by reference, a method andapparatus was presented for efficiently moving sectors within a blockfrom a first area within the nonvolatile memory to an unused area withinthe nonvolatile memory and marking the first area as “used”.

What is however, needed in all of the above referenced solutions is toincrease the efficiency of the system by quickly detecting defectiveblocks within the flash memory and to introduce various ways ofidentifying each block within the flash memory devices without foregoingmemory capacity and performance.

SUMMARY OF THE INVENTION

The present invention is for a nonvolatile memory storage device. Thedevice is configured to avoid having to perform an erase-before-writeeach time a data file is changed. Further, to avoid the overheadassociated with CAM cells, this approach utilizes a RAM array. The hostsystem maintains organization of the mass storage data by using alogical block address. The RAM array is arranged to be addressable bythe same address as the logical block addresses (LBA) of the host. Eachsuch addressable location in the RAM includes a field which holds thephysical address of the data in the nonvolatile mass storage expected bythe host. This physical block address (PBA) information must be shadowedin the nonvolatile memory to ensure that the device will still functionafter resuming operation after a power down because RAMs are volatilememory devices. In addition, status flags are also stored for eachphysical location. The status flags can be stored in either thenonvolatile media or in both the RAM and in the nonvolatile media.

The device includes circuitry for performing two primary algorithms andan associated hardware architecture for a semiconductor mass storagedevice. The first algorithm provides a means for mapping of host logicalblock address to physical block address with much improved performanceand minimal hardware assists. In addition, the second algorithm providesmeans for avoiding an erase-before-write cycle when writing a modifieddata file back onto the mass storage device. Instead, no erase isperformed and the modified data file is written onto an empty portion ofthe mass storage.

Reading is performed in the present invention by providing the logicalblock address to the memory storage. The RAM array is arranged so thatthe logical block address selects one RAM location. That locationcontains the physical block address of the data requested by the host orother external system. That data file is then read out to the host.

According to the second algorithm, erase cycles are avoided byprogramming an altered data file into an altered data mass storage blockrather than itself after an erase cycle of the block as done on previousarts.

In an alternative embodiment of the present invention, a method andapparatus is presented for efficiently moving sectors within a blockfrom a first area within the nonvolatile memory to an unused area withinthe nonvolatile memory and marking the first area as “used”.

Briefly, A preferred embodiment of the present invention includes amethod and apparatus for storing mapping information for mapping alogical block address identifying a lock being accessed by a host to aphysical block address, identifying a free area of volatile memory, theblock being selectively erasable and having one or more sectors that aybe individually moved. The mapping information including a virtualphysical block dress for identifying an “original” location, within thenonvolatile memory, wherein a block is stored and a moved virtualphysical block address for identifying a “moved” location, within thenonvolatile memory, wherein one or more sectors of the stored block aremoved. The mapping information further including status information foruse of the “original” physical block address and the “moved” physicalblock address and for providing information regarding “moved” sectorswithin the block being accessed.

IN THE DRAWINGS

FIG. 1 shows a schematic block diagram of an architecture for asemiconductor mass storage according to the present invention.

FIG. 2 shows an alternative embodiment to the physical block address 102of the RAM storage of FIG. 1.

FIG. 3 shows a block diagram of a system incorporating the mass storagedevice of the present invention.

FIGS. 4 through 8 show the status of several of the flags andinformation for achieving the advantages of the present invention.

FIG. 9 shows a flow chart block diagram of the first algorithm accordingto the present invention.

FIG. 10 shows a high-level block diagram of a digital system, such as adigital camera, including a preferred embodiment of the presentinvention.

FIGS. 11-19 illustrate several examples of the state of a mapping tablethat may be stored in the digital system of FIG. 10 including LBA-PBAmapping information.

FIG. 20 depicts an example of a nonvolatile memory device employed inthe preferred embodiment of FIG. 10.

FIG. 21 shows a high-level flow chart of the general steps employed inwriting a block of information to the nonvolatile devices of FIG. 10.

FIG. 22 shows an example of the contents of flash memory devices in analternative embodiment of the present invention using a novel defectflag and LBA address means.

FIG. 23 is an example of the contents of flash memory devices whereinanother alternative embodiment of the present invention stores the LBAaddress for each block in two different sector locations within theblock.

FIGS. 24 and 24a-24 b shows an example of yet another alternativeembodiment of the present invention wherein the contents of the flashmemory devices and the SPM RAM block are depicted to illustrate thecorrelation between the LBA and PBA addressing as employed by the systemof FIG. 10.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT

FIG. 1 shows an architecture for implementation of a solid state storagemedia according to the present invention. The storage media is for usewith a host or other external digital system. The mass storage ispartitioned into two portions, a volatile RAM array 100 and anonvolatile array 104. According to the preferred embodiment, all of thenonvolatile memory storage is FLASH. The FLASH may be replaced byEEPROM. The RAM can be of any convenient type.

The memory storage 104 is arranged into N blocks of data from zerothrough N-1. Each of the blocks of data is M Bytes long. In thepreferred embodiment, each data block is 512 Bytes long to correspondwith a sector length in a commercially available hard disk drive plusthe extra numbers of bytes to store the flags and logical block address(LBA) information and the associated ECC. The memory 104 can contain asmuch memory storage as a user desires. An example of a mass storagedevice might include 100 M Byte of addressable storage.

There are a plurality of RAM locations 102. Each RAM location 102 isuniquely addressable by controller using an appropriate one of thelogical block addresses provided by the host system or the actualphysical address of the nonvolatile media. The RAM location 102 containsthe physical block address of the data associated with the logical blockaddress and the flags associated with a physical block address on thenonvolatile media.

It is possible that the physical block address (PBA) can be split intotwo fields as shown in FIG. 2. These fields can be used for clusteraddresses of a group of data blocks. The first such field 290 is used toselect a cluster address and the second such field 292 can be used toselect the start address of the logical block address associated withthis cluster.

A collection of information flags is also stored for each nonvolatilememory location 106. These flags include an old/new flag 110, aused/free flag 112, a defect flag 114, and a single/sector flag 116.Additionally, there is also a data store 122.

When writing data to the mass storage device of the present invention, acontroller determines the first available physical block for storing thedata. The RAM location 102 corresponding to the logical block addressselected by the host is written with the physical block address wherethe data is actually stored within the nonvolatile memory array in 104(FIG. 1).

Assume for example that a user is preparing a word processing documentand instructs the computer to save the document. The document will bestored in the mass storage system. The host system will assign it alogical block address. The mass storage system of the present inventionwill select a physical address of an unused block or blocks in the massstorage for storing the document. The address of the physical blockaddress will be stored into the RAM location 102 corresponding to thelogical block address. As the data is programmed, the system of thepresent invention also sets the used free flag 112 in 104 and 293 toindicate that this block location is used. One used/free flag 112 isprovided for each entry of the nonvolatile array 104.

Later, assume the user retrieves the document, makes a change and againinstructs the computer to store the document. To avoid anerase-before-write cycle, the system of the present invention providesmeans for locating a block having its used/free flag 112 in 100 unset(not programmed) which indicates that the associated block is erased.The system then sets the used/free flag for the new block 112 of 106 and293 of 100 and then stores the modified document in that new physicalblock location 106 in the nonvolatile array 104. The address of the newphysical block location is also stored into the RAM location 102corresponding the logical block address, thereby writing over theprevious physical block location in 102. Next, the system sets theold/new flag 110 of the previous version of the document indicating thatthis is an old unneeded version of the document in 110 of 104 and 293 of109. In this way, the system of the present invention avoids theoverhead of an erase cycle which is required in the erase-before-writeof conventional systems to store a modified version of a previousdocument.

Because of RAM array 100 will lose its memory upon a power downcondition, the logical block address with the active physical blockaddress in the media is also stored as a shadow memory 108 in thenonvolatile array 104. It will be understood the shadow information willbe stored into the appropriate RAM locations 102 by the controller.During power up sequence, the RAM locations in 100 are appropriatelyupdated from every physical locations in 104, by reading the information106 of 104. The logical address 108 of 106 is used to address the RAMlocation of 100 to update the actual physical block address associatedwith the given logical block address. Also since 106 is the actualphysical block address associated with the new data 122, the flags 110,112, 114, and 116 arc updated in 293 of 102 with the physical blockaddress of 106 in 100. It will be apparent to one of ordinary skill inthe art that the flags can be stored in either the appropriatenonvolatile memory location 106 or in both the nonvolatile memorylocation and also in the RAM location 102 associated with the physicalblock address.

During power up, in order to assign the most recent physical blockaddress assigned to a logical block address in the volatile memory 100,the controller will first read the Flags 110, 112, 114, and 116 portionof the nonvolatile memory 104 and updates the flags portion 293 in thevolatile memory 100. Then it reads the logical block address 108 ofevery physical block address of the nonvolatile media 104 and bytracking the flags of the given physical block address in the volatilememory 100, and the read logical block address of the physical blockaddress in the nonvolatile memory 104, it can update the most recentphysical block address assigned to the read logical block address in thevolatile memory 100.

FIG. 3 shows a block diagram of a system incorporating the mass storagedevice of the present invention. An external digital system 300 such asa host computer, personal computer and the like is coupled to the massstorage device 302 of the present invention. A logical block address iscoupled via an address bus 306 to the volatile RAM array 100 and to acontroller circuit 304. Control signals are also coupled to thecontroller 304 via a control bus 308. The volatile RAM array 1.00 iscoupled for providing the physical block address to the nonvolatile RAMarray 400. The controller 304 is coupled to control both the volatileRAM 100, the nonvolatile array 104, and for the generation of all flags.

A simplified example, showing the operation of the write operationaccording to the present invention is shown in FIGS. 4 through 8. Notall the information flags are shown to avoid obscuring these features ofthe invention in excessive detail. The data entries are shown usingdecimal numbers to further simplify the understanding of the invention.It will be apparent to one of ordinary skill in the art that in apreferred embodiment binary counting will be used.

FIG. 4 shows an eleven entry mass storage device according to thepresent invention. There is no valid nor usable data stored in the massstorage device of FIG. 4. Accordingly, all the physical block addressesare empty. The data stored in the nonvolatile mass storage location ‘6’is filled and old. Additionally, location ‘9’ is defective and cannot beused.

The host directs the mass storage device of the example to write datapursuant to the logical block address ‘3’ and then to ‘4’. The massstorage device will first write the data associated with the logicalblock address ‘3’. The device determines which is the first unusedlocation in the nonvolatile memory. In this example, the first emptylocation is location ‘0’. Accordingly, FIG. 5 shows that for the logicalblock address ‘3’, the corresponding physical block address ‘0’ isstored and the used flag is set in physical block address ‘0’. The nextempty location is location ‘1’. FIG. 6 shows that for the logical blockaddress ‘4’, the corresponding physical block address ‘1’ is stored andthe used flag is set in physical block address ‘1’.

The host instructs that something is to be written to logical blockaddress ‘3’ again. The next empty location is determined to be location‘2’. FIG. 7 shows that the old flag in location ‘0’ is set to indicatethat this data is no longer usable, the used flag is set in location ‘2’and the physical block address in location ‘3’ is changed to ‘2’.

Next, the host instructs that something is to be written to logicalblock address ‘4’ again. The next empty location is determined to belocation ‘3’. FIG. 8 shows that the old flag in location ‘1’ is set toindicate that this data is no longer usable, the used flag is set inlocation ‘3’ and the physical block address in location ‘4’ is changedto ‘3’. (Recall that there is generally no relation between the physicalblock address and the data stored in the same location.)

FIG. 9 shows algorithm 1 according to the present invention. When thesystem of the present invention receives an instruction to program datainto the mass storage (step 200), then the system attempts to locate afree block (step 202), i.e., a block having an unset (not programmed)used/free flag. If successful, the system sets the used/free flag forthat block and programs the data into that block (step 206).

If on the other hand, the system is unable to locate a block having anunset used/free flag, the system erases the flags (used/free andold/new) and data for all blocks having a set old/new flag and unsetdefect flag (step 204) and then searches for a block having an unsetused/free flag (step 202). Such a block has just been formed by step204. The system then sets the used/flag for that block and programs thedata file into that block (step 206).

If the data is a modified version of a previously existing file, thesystem must prevent the superseded version from being accessed. Thesystem determines whether the data file supersedes a previous data file(step 208). If so, the system sets the old/new flag associated with thesuperseded block (step 210). If on the other hand, the data file to bestored is a newly created data file, the step of setting the old/newflag (step 210) is skipped because there is no superseded block. Lastly,the map for correlating the logical address 308- to the physicaladdresses updated (step 212).

By following the procedure outlined above, the overhead associated withan erase cycle is avoided for each write to the memory 104 except forperiodically. This vastly improves the performance of the overallcomputer system employing the architecture of the present invention.

In the preferred embodiment of the present invention, the programming ofthe flash memory follows the procedure commonly understood by those ofordinary skill in the art. In other words, the program impulses areappropriately applied to the bits to be programmed and then compared tothe data being programmed to ensure that proper programming hasoccurred. In the event that a bit fails to be erased or programmedproperly, a defect flag 148 is set which prevent that block from beingused again.

FIG. 10 depicts a digital system 500 such as a digital camera employingan alternative embodiment of the present invention. Digital system 500is illustrated to include a host 502, which may be a personal computer(PC) or simply a processor of any generic type commonly employed indigital systems, coupled to a controller circuit 506 for storing in andretrieving information from non-volatile memory unit 508. The controllercircuit 506 may be a semiconductor (otherwise referred to as an“integrated circuit” or “chip”) or optionally a combination of variouselectronic components. In the preferred embodiment, the controllercircuit is depicted as a single chip device. The non-volatile memoryunit 508 is comprised of one or more memory devices, which may each beflash or EEPROM types of memory. In the preferred embodiment of FIG. 10,memory unit 508 includes a plurality of flash memory devices, 510-512,each flash device includes individually addressable locations forstoring information. In the preferred application of the embodiment inFIG. 10, such information is organized in blocks with each block havingone or more sectors of data. In addition to the data, the informationbeing stored may further include status information regarding the datablocks, such as flag fields, address information and the like.

The host 502 is coupled through host information signals 504 to acontroller circuit 506. The host information signals comprise of addressand data busses and control signals for communicating command, data andother types of information to the controller circuit 506, which in turnstores such information in memory unit 508 through flash address bus512, flash data bus 514, flash signals 516 and flash status signals 518(508 and 512-516 collectively referred to as signals 538). The signals538 may provide command, data and status information between thecontroller 506 and the memory unit 508.

The controller 506 is shown to include high-level functional blocks suchas a host interface block 520, a buffer RAM block 522, a flashcontroller block 532, a microprocessor block 524, a microprocessorcontroller block 528, a microprocessor storage block 530, amicroprocessor ROM block 534, an ECC logic block 540 and a space managerblock 544. The host interface block 520 receives host informationsignals 504 for providing data and status information from buffer RAMblock 522 and microprocessor block 524 to the host 502 through hostinformation signals 504. The host interface block 520 is coupled to themicroprocessor block 524 through the microprocessor information signals526, which is comprised of an address bus, a data bus and controlsignals.

The microprocessor block 524 is shown coupled to a microprocessorcontroller block 528, a microprocessor storage block 530 and amicroprocessor ROM block 534, and serves to direct operations of thevarious functional blocks shown in FIG. 10 within the controller 506 byexecuting program instructions stored in the microprocessor storageblock 530 and the microprocessor ROM block 534. Microprocessor 524 may,at times, execute program instructions (or code) from microprocessor ROMblock 534, which is a non-volatile storage area. On the other hand,microprocessor storage block 530 may be either volatile, i.e.,read-and-write memory (RAM), or non-volatile, i.e., EEPROM, type ofmemory storage. The instructions executed by the microprocessor block524, collectively referred to as program code, are stored in the storageblock 530 at some time prior to the beginning of the operation of thesystem of the present invention. Initially, and prior to the executionof program code from the microprocessor storage location 530, theprogram code may be stored in the memory unit 508 and later downloadedto the storage block 530 through the signals 538. During thisinitialization, the microprocessor block 524 can execute instructionsfrom the ROM block 534.

Controller 506 further includes a flash controller block 532 coupled tothe microprocessor block 524 through the microprocessor informationsignals 526 for providing and receiving information from and to thememory unit under the direction of the microprocessor. Information suchas data may be provided from flash controller block 532 to the bufferRAM block 522 for storage (may be only temporary storage) thereinthrough the microprocessor signals 526. Similarly, through themicroprocessor signals 526, data may be retrieved from the buffer RAMblock 522 by the flash controller block 532.

ECC logic block 540 is coupled to buffer RAM block 522 through signals542 and further coupled to the microprocessor block 524 throughmicroprocessor signals 526. ECC logic block 540 includes circuitry forgenerally performing error coding and correction functions. It should beunderstood by those skilled in the art that various ECC apparatus andalgorithms are commercially available and may be employed to perform thefunctions required of ECC logic block 540. Briefly, these functionsinclude appending code that is for all intensive purposes uniquelygenerated from a polynomial to the data being transmitted and when datais received, using the same polynomial to generate another code from thereceived data for detecting and potentially correcting a predeterminednumber of errors that may have corrupted the data. ECC logic block 540performs error detection and/or correction operations on data stored inthe memory unit 508 or data received from the host 502.

The space manager block 544 employs a preferred apparatus and algorithmfor finding the next unused (or free) storage block within one of theflash memory devices for storing a block of information, as will befurther explained herein with reference to other figures. As earlierdiscussed, the address of a block within one of the flash memory devicesis referred to as PBA, which is determined by the space manager byperforming a translation on an LBA received from the host. A variety ofapparatus and method may be employed for accomplishing this translation.An example of such a scheme is disclosed in U.S. Pat. No. 5,485,595,entitled “Flash Memory Mass Storage Architecture Incorporating WearLeveling Technique Without Using CAM Cells”, the specification of whichis herein incorporated by reference. Other LBA to PBA translationmethods and apparatus may be likewise employed without departing fromthe scope and spirit of the present invention.

Space manager block 544 includes SPM RAM block 548 and SPM control block546, the latter two blocks being coupled together. The SPM RAM block 548stores the LBA-PBA mapping information (otherwise herein referred to astranslation table, mapping table, mapping information, or table) underthe control of SPM control block 546. Alternatively, the SPM RAM block548 may be located outside of the controller, such as shown in FIG. 3with respect to RAM array 100.

In operation, the host 502 writes and reads information from and to thememory unit 508 during for example, the performance of a read or writeoperation through the controller 506. In so doing, the host 502 providesan LBA to the controller 506 through the host signals 504. The LBA isreceived by the host interface block 520. Under the direction of themicroprocessor block 524, the LBA is ultimately provided to the spacemanager block 544 for translation to a PBA and storage thereof, as willbe discussed in further detail later.

Under the direction of the microprocessor block 524, data and otherinformation are written into or read from a storage area, identified bythe PBA, within one of the flash memory devices 510-512 through theflash controller block 532. The information stored within the flashmemory devices may not be overwritten with new information without firstbeing erased, as earlier discussed. On the other hand, erasure of ablock of information (every time prior to being written), is a very timeand power consuming measure. This is sometimes referred to aserase-before-write operation. The preferred embodiment avoids such anoperation by continuously, yet efficiently, moving a sector (or multiplesectors) of information, within a block, that is being re-written from aPBA location within the flash memory to an unused PBA location withinthe memory unit 508 thereby avoiding frequent erasure operations. Ablock of information may be comprised of more than one sector such as 16or 32 sectors. A block of information is further defined to be anindividually-erasable unit of information. In the past, prior artsystems have moved a block stored within flash memory devices that hasbeen previously written into a free (or unused) location within theflash memory devices. Such systems however, moved an entire block evenwhen only one sector of information within that block was beingre-written. In other words, there is waste of both storage capacitywithin the flash memory as well as waste of time in moving an entireblock's contents when less than the total number of sectors within theblock are being re-written. The preferred embodiments of the presentinvention, as discussed herein, allow for “moves” of less than a blockof information thereby decreasing the number of move operations ofpreviously-written sectors, consequently, decreasing the number of eraseoperations.

Referring back to FIG. 10, it is important to note that the SPM RAMblock 548 maintains a table that may be modified each time a writeoperation occurs thereby maintaining the LBA-PBA mapping information andother information regarding each block being stored in memory unit 508.Additionally, this mapping information provides the actual location of asector (within a block) of information within the flash memory devices.As will be further apparent, at least a portion of the information inthe mapping table stored in the SPM RAM block 548 is “shadowed” (orcopied) to memory unit 508 in order to avoid loss of the mappinginformation when power to the system is interrupted or terminated. Thisis, in large part, due to the use of volatile memory for maintaining themapping information. In this connection, when power to the system isrestored, the portion of the mapping information stored in the memoryunit 508 is transferred to the SPM RAM block 548.

It should be noted, that the SPM RAM block 548 may alternatively benonvolatile memory, such as in the form of flash or EEPROM memoryarchitecture. In this case, the mapping table will be stored withinnonvolatile memory thereby avoiding the need for “shadowing” becauseduring power interruptions, the mapping information stored innonvolatile memory will be clearly maintained.

When one or more sectors are being moved from one area of the flashmemory to another area, the preferred embodiment of the presentinvention first moves the sector(s) from the location where they arestored in the flash memory devices, i.e., 510-512, to the buffer RAMblock 522 for temporary storage therein. The moved sector(s) are thenmoved from the buffer RAM block 522 to a free area within one of theflash memory devices. It is further useful to note that the ECC codegenerated by the ECC logic block 540, as discussed above, is also storedwithin the flash memory devices 510-512 along with the data, as is otherinformation, such as the LBA corresponding to the data and flag fields.

FIGS. 11-19 are presented to show examples of the state of a table 700in SPM RAM block 548 configured to store LBA-PBA mapping information foridentification and location of blocks (and sectors within the blocks)within the memory unit 508. Table 700 in all of these figures is shownto include an array of columns and rows with the columns includingvirtual physical block address locations or VPBA block address locations702, move virtual physical address locations or MVPBA block addresslocations 704, move flag locations 706, used/free flag locations 708,old/new flag locations 710, defect flag locations 712 and sector movestatus locations 714.

The rows of table include PBA/LBA rows 716, 718 through 728 with eachrow having a row number that may be either an LBA or a PBA dependingupon the information that is being addressed within the table 700. Forexample, row 716 is shown as being assigned row number ‘00’ and if PBAinformation in association with LBA ‘00’ is being retrieved from table700, then LBA ‘00’ may be addressed in SPM RAM block 548 at row 716 toobtain the associated PBA located in 730. On the other hand, if statusinformation, such as flag fields, 706-712, regarding a block is beingaccessed, the row numbers of rows 716-728, such as ‘00’, ‘10’, ‘20’,‘30’, ‘40’, ‘50’, ‘N-1’ represent PBA, as opposed to LBA, values.Furthermore, each row of table 700 may be thought of as a block entrywherein each entry contains information regarding a block. Furthermore,each row of table 700 may be addressed by an LBA.

In the preferred embodiment, each block is shown to include 16 sectors.This is due to the capability of selectively erasing an entire block of16 sectors (which is why the block size is sometimes referred to as an“erase block size”. If an erase block size is 16 sectors, such as shownin FIGS. 11-19, each block entry (or row) includes information regarding16 sectors. Row 716 therefore includes information regarding a blockaddressed by LBA ‘00’ through LBA ‘15’ (or LBA ‘00’ through LBA ‘0F’ inHex. notation). The next row, row 718, includes information regardingblocks addressed by LBA ‘16’ (or ‘10’ in Hex.) through LBA ‘31’ (or ‘1F’in Hex.) The same is true for PBAs of each block.

It should be noted however, other block sizes may be similarly employed.For example, a block may include 32 sectors and therefore an erase blocksize 32. In the latter situation, each block entry or row, such as 716,718, 720 . . . , would include information regarding 32 sectors. whereeach block comprises of 16 sectors (other than 16-sector block sizes maybe similarly employed).

The VPBA block address locations 702 of table 700 stores informationgenerally representing a PBA value corresponding to a particular LBAvalue. The MVPBA block address locations 704 store informationrepresenting a PBA value identifying, within the memory unit 508, thelocation of where a block (or sector portions thereof) may have beenmoved. The move flag locations 706 store values indicating whether theblock being accessed has any sectors that may have been moved to alocation whose PBA is indicated by the value in the MVPBA block addresslocation 704 (the PBA value within 704 being other than the valueindicated in VPBA block address 702 wherein the remaining block addressinformation may be located). The used/new flag location 708 storesinformation to indicate whether the block being accessed is a freeblock, that is, no data has been stored since the block was last erased.The old/new flag location 710 stores information representing the statusof the block being accessed as to whether the block has been used andre-used and therefore, old. The defect flag location 712 storesinformation regarding whether the block is defective. If a block isdeclared defective, as indicated by the value in the defect flaglocation 712 being set, the defective block can no longer be used. Flags708-712 are similar to the flags 110-114 shown and described withrespect to FIG. 1.

Sector move status location 714 is comprised of 16 bits (location 714includes a bit for each sector within a block so for different-sizedblocks, different number of bits within location 714 are required) witheach bit representing the status of a sector within the block as towhether the sector has been moved to another block within the memoryunit 508. The moved block location within the memory unit 508 would beidentified by a PBA that is other than the PBA value in VPBA blockaddress location 702. Said differently, the status of whether a sectorwithin a block has been moved, as indicated by each of the bits within714, suggests which one of either the VPBA block address locations 702or the MBPBA block address locations 704 maintain the most recent PBAlocation for that sector.

Referring still to FIG. 11, an example of the status of the table 700stored in SPM RAM block 548 (in FIG. 10) is shown when, by way ofexample, LBA ‘0’ is being written. As previously noted, in the figurespresented herein, a block size of sixteen sectors (number 0-15 indecimal notation or 0-10 in hexadecimal notation) is used to illustrateexamples only. Similarly, N blocks (therefore N LBAs) are employed,numbered from 0-N-1. The block size and the number of blocks are bothdesign choices that may vary for different applications and may dependupon the memory capacity of each individual flash memory device (such as510-512) being employed. Furthermore, a preferred sector size of 512bytes is used in these examples whereas other sector sizes may beemployed without departing from the scope and spirit of the presentinvention.

Assuming that the operation of writing to LBA ‘0’ is occurring afterinitialization or system power-up when all of the blocks within theflash memory devices 510-512 (in FIG. 10) have been erased and are thusfree. The space manager block 548 is likely to determine that the nextfree PBA location is ‘00’. Therefore, ‘00’ is written to 730 in VPBAblock address 702 of row 716 wherein information regarding LBA ‘0’ ismaintained, as indicated in table 700 by LBA row number ‘00’. Since noneed exists for moving any of the sectors within the LBA 0 block, theMVPBA block address 704 for row 716, which is shown as location 732 mayinclude any value, such as an initialization value (in FIG. 11, ‘XX’ isshown to indicate a “don't care” state).

The value in 734 is at logic state ‘0’ to show that LBA ‘0’ block doesnot contain any moved sectors. Location 736 within the used flag 708column of row 716 will be set to logic state ‘1’ indicating that the PBA‘0’ block is in use. The state of location 738, representing the oldflag 710 for row 716, is set to ‘0’ to indicate that PBA ‘0’ block isnot “old” yet. Location 740 maintains logic state ‘0’ indicating thatthe PBA ‘0’ block is not defective and all of the bits in move statuslocation 714 are at logic state ‘0’ to indicate that none of the sectorswithin the LBA ‘0’ through LBA ‘15’ block have been moved.

In FIG. 11, the status information for LBA ‘0’ in row 716, such as inmove flag location 706, used flag location 708, old flag location 710,defect flag location 712 and move status location 714 for all remainingrows, 716-728, of table 700 are at logic state ‘0’. It is understoodthat upon power-up of the system and/or after erasure of any of theblocks, the entries for the erased blocks, which would be all blocksupon power-up, in table 700, are all set to logic state ‘0’.

At this time, a discussion of the contents of one of the flash memorydevices within the memory unit 508, wherein the LBA ‘0’ block may belocated is presented for the purpose of a better understanding of themapping information shown in table 700 of FIG. 11.

Turning now to FIG. 20, an example is illustrated of the contents of theflash memory device 510 in accordance with the state of table 700 (asshown in FIG. 11). LBA ‘0’, which within the memory unit 508 isidentified at PBA ‘0’ by controller 506 (of FIG. 10) is the locationwherein the host-identified block is written. A PBA0 row 750 is shown inFIG. 22 to include data in sector data location 752. An ECC code isfurther stored in ECC location 754 of PBA0 row 750. This ECC code isgenerated by the ECC logic block 540 in association with the data beingwritten, as previously discussed. Flag field 756 in PBA0 row 750contains the move, used, old and defect flag information correspondingto the sector data of the block being written. In this example, in flagfield 756, the “used” flag and no other flag is set, thus, flag field756 maintains a logic state of ‘0100’ indicating that PBA ‘0’ is “used”but not “moved”, “old” or “defective”.

PBA0 row 750 additionally includes storage location for maintaining inLBA address location 758, the LBA number corresponding to PBA ‘0’, whichin this example, is ‘0’. While not related to the example at hand, theremaining PBA locations of LBA ‘0’ are stored in the next 15 rowsfollowing row 750 in the flash memory device 510.

It will be understood from the discussion of the examples providedherein that the information within a PBA row of flash memory device 510is enough to identify the data and status information relating theretowithin the LBA ‘0’ block including any moves associated therewith,particularly due to the presence of the “move” flag within each PBA row(750, 762, 764, . . . ) of the flash memory. Nevertheless,alternatively, another field may be added to the first PBA row of eachLBA location within the flash, replicating the status of the bits in themove status location 714 of the corresponding row in table 700. Thisfield is optionally stored in sector status location 760 shown in FIG.20 to be included in the first PBA row of each LBA block, such as row750, 780 and so on. Although the information maintained in location 760may be found by checking the status of the “move” flags within the flagfields 756 of each PBA row, an apparent advantage of using location 760is that upon start-up (or power-on) of the system, the contents of table700 in SPM RAM block 548 may be updated more rapidly due to fewer readoperations (the reader is reminded that table 700 is maintained in SPMRAM 548, which is volatile memory whose contents are lost when thesystem is power-down and needs to be updated upon power-up fromnon-volatile memory, i.e. memory unit 508).

That is, rather than reading every PBA row (altogether 16 rows in thepreferred example) to update each LBA entry of the table 700 uponpower-up, only the first PBA row of each LBA must be read from flashmemory and stored in SPM RAM 548 thereby saving time by avoidingneedless read operations. On the other hand, clearly more memorycapacity is utilized to maintain 16 bits of sector status informationper LBA.

In the above example, wherein location 760 is used, the value in sectorstatus location 760 would be all ‘0’s (or ‘0000’ in hexadecimalnotation).

In flash memory device 510, each of the rows 750, 762, 764, 768 . . . ,is a PBA location with each row having a PBA row number and for storingdata and other information (data and other information are as discussedabove with respect to row 750) for a sector within a block addressed bya particular LBA. Furthermore, every sixteen sequential PBA rowsrepresents one block of information. That is, PBA rows 750, 762, 764through 768, which are intended to show 16 PBA rows correspond to LBA0(shown as row 716 in table 700 of FIG. 11) and each of the PBA rowsmaintains information regarding a sector within the block. The nextblock of information is for the block addressed by LBA ‘10’ (in Hex.)whose mapping information is included in row 718 of table 700, and whichis stored in locations starting from ‘10’ (in hexadecimal notation, or‘16’ in decimal notation) and ending at ‘1F’ (in hexadecimal notation,or ‘31’) in the flash memory device 510 and so on.

Continuing on with the above example, FIG. 12 shows an example of thestate of table 700 when LBA 0 is again being written by the host. SinceLBA 0 has already been written and is again being written without firstbeing erased, another free location within the memory unit 508 (it mayserve helpful to note here that the blocks, including their sectors, areorganized sequentially and continuously through each of the flash memorydevices of memory unit 508 according to their PBAs such that forexample, the next flash memory device following device 510 picks up thePBA-addressed blocks where flash memory device 510 left off, an exampleof this is where flash memory device 510 includes PBAs of 0-FF (in Hex.)and the next flash memory device, which may be 512, may then include100-1FF (in Hex.)) is located by space manager 544 for storage of thenew information. This free location is shown to be PBA ‘10’ (inHexadecimal notation, or 16 in decimal notation). In row 718, where theentries for LBA ‘10’ will remain the same as shown in FIG. 11 except theused flag in location 742 will be set (in the preferred embodiment, aflag is set when it is at logic state ‘1’ although the opposite polaritymay be used without deviating from the present invention) to indicatethat the PBA ‘10’ is now “in use”.

The entries in row 716 are modified to show ‘10’ in MVPBA block addresslocation 732, which provides the PBA address of the moved portion forthe LBA ‘00’ block. The move flag in location 734 is set to logic state‘1’ to indicate that at least a portion (one or more sectors) of the LBA‘00’ block have been moved to a PBA location other than the PBA locationindicated in location 730 of table 700. Finally, the bits of the movestatus location 714 in row 716 are set to ‘1000000000000000’ (in binarynotation, or ‘8000’ in hexadecimal notation), reflecting the status ofthe moved sectors within the block LBA ‘00’. That is, in this example,‘8000’ indicates that the first sector, or sector ‘0’, within LBA ‘00’block has been moved to a different PBA location.

Referring now to FIG. 20, the state of table 700 in FIG. 12 will affectthe contents of the flash memory device 510 in that the moved sector ofthe LBA ‘0’ block will now be written to PBA ‘10’ in row 780. Row 780will then include the data for the moved sector, which is 512 bytes insize. With respect to the moved sector information, row 780 furtherincludes ECC code, a copy of the values in flag locations 734-740 oftable 700 (in FIG. 12), and LBA ‘00’ for indicating that the data in row780 belongs to LBA ‘00’ and may further include the move status for eachof the individual sectors within the LBA ‘0’ block.

While not specifically shown in the figure, the move flag withinlocation 756 of PBA row 750 is set to indicate that at least a portionof the corresponding block has been moved. The value stored in the movestatus location 714 of row 716 (in FIG. 12), which is ‘8000’ in Hex., isalso stored within location 760 of the row 750. As earlier noted, thisindicates that only sector ‘0’ of PBA ‘0’ was marked “moved” and the newblock LBA ‘0’ was written to PBA ‘10’ in flash memory. Without furtherdetailed discussions of FIG. 22, it should be appreciated that theexamples to follow likewise affect the contents of the flash memorydevice 510.

FIG. 13 shows the status of table 700 when yet another write operationto LBA ‘00’ is performed. The values (or entries) in row 716 remain thesame as in FIG. 12 except that the value in location 732 is changed to‘20’ (in Hex. Notation) to indicate that the moved portion of block LBA‘00’ is now located in PBA location ‘20’ (rather than ‘10’ in FIG. 12).As in FIG. 12, the value in move status location 714, ‘8000’, indicatesthat the first sector (with PBA ‘00’) is the portion of the block thathas been moved. Row 718 is modified to show that the LBA ‘10’ block isnow old and can no longer be used before it is erased. This is indicatedby the value in location 744 being set to logic state ‘1’. The entriesfor LBA ‘20’, row 720, remain unchanged except that location 746 ismodified to be set to logic state ‘1’ for reflecting the state of thePBA ‘20’ block as being in use. It is understood that as in FIGS. 11 and12, all remaining values in table 700 of FIG. 13 that have not beendiscussed above and are not shown as having a particular logic state inFIG. 13 are all unchanged (the flags are all set to logic state ‘0’).

FIGS. 14-16 show yet another example of what the state of table 700 maybe after either power-up or erasure of the blocks with the memory unit508. In FIGS. 14 and 15, the same write operations as those discussedwith reference to FIGS. 11 and 12 are perforrned. The state of table 700in FIGS. 16 and 17 resembles that of FIGS. 11 and 12, respectively (thelatter two figures have been re-drawn as FIGS. 14 and 15 for the soleconvenience of the reader). Briefly, FIG. 14 shows the state of table700 after a write to LBA ‘0’ and FIG. 15 shows the state of table 700after another write to LBA ‘0’.

FIG. 16 picks up after FIG. 15 and shows the state of table 700 afterthe host writes to LBA ‘5’. As indicated in FIG. 16, LBA ‘5’ has beenmoved to PBA ‘10’ where LBA ‘0’ is also located. To this end, MBPBAblock address location 732 is set to ‘10’ in row 716 and the move flagis set at location 734 in the same row. Moreover, the state of movestatus location 714 in row 716 is set to ‘8400’ (in Hex.) indicatingthat LBA ‘0’ and LBA ‘5’ have been moved, or that the first and fifthsectors within LBA ‘00’ are moved. Being that these two sectors are nowlocated in the PBA ‘10’ location of the flash memory device 510, themove flag for each of the these sectors are also set in the flash memorydevice 510. It should be understood that LBA ‘5’ was moved to PBA ‘10’because remaining free sectors were available in that block. Namely,even with LBA ‘0’ of that block having been used, 15 other sectors ofthe same block were available, from which the fifth sector is now in useafter the write to LBA ‘5’.

Continuing on with the example of FIG. 16, in FIG. 17, the state of thetable 700 is shown after the host writes yet another time to LBA ‘0’.According to the table, yet another free PBA location, ‘20’, is foundwhere both the LBA ‘5’ and LBA ‘0’ are moved. First, LBA ‘5’ is moved tothe location PBA ‘10’ to PBA ‘20’ and then the new block of location LBA‘0’ is written to PBA ‘20’. As earlier discussed, any time there is amove of a block (for example, here the block of LBA ‘5’ is moved) it isfirst moved from the location within flash memory where it currentlyresides to a temporary location within the controller 506, namely withthe buffer RAM block 522, and then it is transferred from there to thenew location within the flash memory devices.

The used flag in location 746 of row 720 is set to reflect the use ofthe PBA ‘20’ location in flash memory and the old flag in location 744is set to discard use of PBA ‘10’ location until it is erased. Again, inflash memory, the state of these flags as well as the state of the moveflag for both the LBA ‘0’ and LBA ‘5’ sectors are replicated.

FIG. 18 picks up from the state of the table 700 shown in FIG. 16 andshows yet another state of what the table 700 may be after the hostwrites to LBA ‘5’. In this case, the block of LBA ‘0’ is first movedfrom location PBA ‘10’ within the flash memory device 510 wherein it iscurrently stored to location PBA ‘20’ of the flash memory. Thereafter,the new block being written to LBA ‘5’ by the host is written intolocation PBA ‘20’ of the flash memory. The flags in both table 700 andcorresponding locations of the flash memory device 510 are accordinglyset to reflect these updated locations.

FIG. 19 also picks up from the state of the table 700 shown in FIG. 16and shows the state of what the table 700 may be after the host writesto LBA ‘7’. In this case, the new block is simply written to locationPBA ‘10’ of the flash memory since that location has not yet been used.Additionally, three of the bits of the move status location 714 in row716 are set to show that LBA ‘0’, LBA ‘5’ and LBA ‘7’ have been moved toanother PBA location within the flash memory. Location 732 shows thatthe location in which these three blocks are stored is PBA ‘10’.

As may be understood from the discussion presented thus far, at somepoint in time, the number of sectors being moved within a block makesfor an inefficient operation. Thus, the need arises for the user to seta threshold for the number of sectors within a block that may be movedbefore the block is declared “old” (the old flag is set) and the blockis no longer used, until it is erased. This threshold may be set at, forexample, half of the number of sectors within a block. This isdemonstrated as follows: For a block having 16 sectors, when 8 of thesectors are moved into another block, the “original” block and the“moved” block (the block in which the moved sectors reside) are combinedinto the same PBA block. The combined PBA block may be stored in a newblock altogether or, alternatively, the “original” block may be combinedwith and moved into the “moved” block. In the latter case, the“original” block is then marked as “old” for erasure thereof. If thecombined PBA block is stored in a new block, both of the “original” andthe “moved” blocks are marked as “old”.

FIG. 21 depicts a general flow chart outlining some of the stepsperformed during a write operation. It is intended to show the sequenceof some of the events that take place during such an operation and isnot at all an inclusive presentation of the method or apparatus used inthe preferred embodiment of the present invention. The steps as outlinedin FIG. 21 are performed under the direction of the microprocessor block524 as it executes program code (or firmware) during the operation ofthe system.

When the host writes to a block of LBA M, step 800, the space managerblock 544, in step 802, checks as to whether LBA M is in use by checkingthe state of the corresponding used flag in table 700 of the SPM RAMblock 548. If not in use, in step 804, a search is performed for thenext free PBA block in memory unit 508. If no free blocks are located,an “error” state is detected in 808. But where a free PBA is located, instep 806, its used flag is marked (or set) in table 700 as well as inflash memory. In step 810, the PBA of the free block is written into theVPBA block address 702 location of the corresponding LBA row in table700.

Going back to step 802, if the LBA M block is in use, search for thenext free PBA block is still conducted in step 812 and upon the findingof no such free block, at 814, an “error” condition is declared.Whereas, if a free PBA location is found, that PBA is marked as used intable 700 and flash memory, at step 816. Next, in step 818, the state ofthe block is indicated as having been moved by setting the move flag aswell as the setting the appropriate bit in the move status location 714of table 700. The new location of where the block is moved is alsoindicated in table 700 in accordance with the discussion above.

Finally, after steps 818 and 810, data and all corresponding statusinformation, ECC code and LBA are written into the PBA location withinthe flash memory.

As earlier indicated, when a substantial portion of a block has sectorsthat have been moved (in the preferred embodiment, this is eight of thesixteen sectors), the block is declared “old” by setting itscorresponding “old” flag. Periodically, blocks with their “old” flagsset, are erased and may then be re-used (or re-programmed, orre-written).

As can be appreciated, an advantage of the embodiments of FIGS. 10-21 isthat a block need not be erased each time after it is accessed by thehost because if for example, any portions (or sectors) of the block arebeing re-written, rather than erasing the block in the flash memorydevices or moving the entire block to a free area within the flash, onlythe portions that are being re-written need be transferred elsewhere inflash, i.e. free location identified by MVPA block address. In thisconnection, an erase cycle, which is time consuming is avoided untillater and time is not wasted in reading an entire block and transferringthe same.

In an alternative embodiment, there may be less information pertainingto each sector that is stored in the flash memory. Likewise, the table700 in the SPM RAM block 548 (in FIG. 10) maintains less informationsuch as explained below.

FIG. 22 shows an example of the information a flash memory chip (such asflash memory device 510) may store. In FIG. 22 is shown, N blocks,blocks 1000, 1002, . . . , 1004, with each block having up to m sectorsUsing block 1000 as an example, each of the sectors 1006, 1008, . . . ,1010 within block 1000 includes a data field 1052 and an ECC field 1014.In the preferred embodiment, the data field 1052 contains 512 bytes andthe ECC field 1014 contains 4 bytes of information although other sizesof both data and ECC may be employed without departing from the spiritof the present invention.

The first sector in each block, for example sector 1006 of block 1000,additionally includes a defect flag 1016 indicating whether the block isdefective or not. In the preferred embodiment, if any of the sectorswithin a block are defective, the entire block is marked defective asfurther explained below.

Each sector within a block may further contain a spare area 1018. Ineach block, there is included an LBA 1020 for identifying the blockwithin the flash memory unit, as will be explained in greater detailshortly. It is however, important to note that the LBA 1020 while shownin FIG. 22 to be located within the last sector 1010 of block 1000, maybe alternatively located within any other sector of block 1000 andfurther within any area within the sector in which it is located. Forexample, LBA 1020 may be located within the spare area 1022 of sector1008 or it may be located at 1024, which is right before the locationwhere data is stored for the sector 1008 of block 1000. The same sectororganization that is used for block 1000 is also used for the remainingblocks such as blocks 1002 and 1004 within the flash memory devices.

Similarly, the location of the defect flag 1012 may be anywhere withinthe block. For example, the defect flag 1012 may be alternatively storedat 1024 or at 1022. But there is only one defect flag stored per block.An aspect of the present invention relates to the way in which thedefect flag is employed.

During manufacturing of flash memory chips, defects within the memoryare commonly identified and marked by the chip manufacturer. This istypically done by writing a predefined pattern (byte-wide) in apredetermined location within a defective block. That is, themanufacturer will erase the flash chip and a value, such as all ‘1’s,will then be carried by each memory cell within the flash chip that wassuccessfully erased. If a sector or a cell within a block is defective,the manufacturer will set a manufacturing defect flag located somewherewithin the defective block (not shown in FIG. 22) to a predeterminedvalue. This manufacturing defect flag is not the same as defect flag1012 and its location is determined by the manufacturer and not bydesign choice. These manufacturer-identified defective blocks are thenignored (or not used) during system operation. That is, the spacemanager block 544 (in FIG. 10) keeps track of these defective blocks andknows not to use them when it searches for a free block within the flashmemory devices.

Other than defects detected during manufacturing of flash chips, theremay be additional defects developed during operation of the chips due towearing as discussed earlier. These defects are sometimes referred to as“grown defects” by the industry at-large and must be accounted for by asystem in which using flash memory devices are employed.

The case of “grown defects” will be explained in the context of systemoperations. In a preferred embodiment of the present invention, aftererasure of the block 1000, the defect flag 1012 (in FIG. 22) isprogrammed to indicate whether the erased block is defective or not.That is, if the cells in the erased block 1000 were successfully erased,the defect flag 1012 is set to a predefined value such as a byte-widevalue of ‘55’ (in Hex.) indicating that the block is not defective. Ifon the other hand, the block is not successfully erased, a value otherthan ‘55’, such as ‘00’, is written to the defect flag 1012 oralternatively, no value is written and whatever the state of the defectflag was after erasure (commonly, an erased state is all ‘1’s (or ‘FF’in Hex.)) will be maintained. In the latter case however, the erasedstate of the defect flag must be a value other than ‘55’ in order todistinguish successful erasures.

The use of the defect flag 1012 is especially noted after power-up ofthe system. The space manager block 544 takes note of which blocks aredefective by quickly scanning the defect flags of each block andidentifying those blocks that are not defective for later by searchingfor the value ‘55’ in the defect flag 1012 of each block. If a block isnot defective after power-up and later becomes defective, its defectflag is modified to so designate and the next time the system ispowered-up, the defective block is noted by the space manager and anyuse of the block is avoided.

During a write operation, if a failure of one or more cells of a blockoccurs, the block is first erased and then marked as being defective bywriting a value other than ‘55’ (such as ‘00’) to the defect flag 1012of the defective block. Alternatively, there is no value written to thedefect flag 1012 of the defective block.

One of the advantages of having a defect flag such as described thus faris that during system power-up, the space manager block 544 (in FIG. 10)is able to quickly find blocks that are not defective.

In an alternative embodiment, as shown in FIG. 23, the LBA for eachblock within the flash memory devices is stored within two differentsectors of the same block. For example, after block 1000 has been erasedand during the first write operation of block 1000 following itserasure, the space manager block 544 determines that block 1000 or aportion thereof is free to be written into. The LBA associated withblock 1000 is then programmed into two locations 1030 and 1020 (withinsectors 1006 and 1010, respectively) of block 1000.

Thereafter, each time power to the system is temporarily interrupted, orupon power-up, the two LBAs in locations 1030 and 1020 are compared toeach other and if they match and the defect flag 1012 indicates that theblock is not defective, the block continues to be used for informationstorage under the direction of the space manager block 544. If however,the defect flag 1012 indicates that the block is not defective but thetwo LBAs do not match, then the block 1000 will still continue to beused but it will first be erased prior to further re-use. The lattercase may arise, for example, when the system was writing to block 1000and the first several sectors starting with sector 0 were written butthen there was a power interruption and information was therefore notwritten to the remaining sectors of block 1000. In this case, the LBAvalues in locations 1030 and 1020 will likely not match because sectorm-1, or sector 1010, of block 1000 was not written into prior to thepower interruption. Upon power restoration, since not completelywritten, the block 1000 should not be used in its state as it was priorto the power interruption. Accordingly, upon detecting a mismatchbetween the two LBA values in locations 1030 and 1020, the controller506 (in FIG. 10) will erase the block 1000 prior to its re-use.

Where only one LBA is used per block, as shown in FIG. 22, obviously,the comparison of two LBAs in each block is not performed yet detectionof blocks that are defective is maintained through the use of the defectflag as explained earlier. Additionally, the LBA may be written last,that is, after all of the sectors of the block are written. Writing theLBA last is an added measure of successfully having written to theblock.

To illustrate another aspect of the present invention, FIG. 24 shows, onthe left-hand side, an example of the contents of several blocks of theflash memory device (this is the same information that is illustrated inFIG. 22) and, on the right-hand side, an example of the contents of thetable 700, which corresponds to the block information that is on theleft-hand side of the figure. The purpose of showing the block contentsis only to serve as convenience to the reader in understanding thecorrelation between the LBA-PBA addressing of the blocks with respect tothe table 700. The example shown in FIG. 24 is to illustrate the mappingof this alternative embodiment between the addresses of the blocks asthey are stored in flash memory and the addresses of the same blocks asthat information is stored in the SPM RAM block 548.

In the table 700, there is shown to be stored in a column, a virtual PBAfield 1036 and a flag field 1038 including a defect flag 1012 for eachrow. Rows 1040, 1042, 1044, . . . , 1050 each correspond to an LBA andare addressed by ‘0’, ‘1’,‘2’, . . . ‘Z’, respectively. The virtual PBAfield 1036 for each row actually contains an LBA address pointer thatpoints to a block within the flash memory having 16 sectors storedtherein. In this respect, the virtual PBA serves as the PBA for 16sectors (the number of sectors may be other than sixteen in alternativeembodiments).

If the host sends a command to read for example, LBA 05, the controller506, in FIG. 10, first masks the four least significant bits (LSBs) ofthe value ‘05’ to obtain the value ‘00’. Then using ‘00’ as the rowaddress for table 700, the row 1040 in FIG. 24 is addressed. Note thatthe reason the four LSBs of the LBA value sent by the host is masked isbecause there are 16 sectors being represented by each row of table 700.16 sectors is two to the power of 4 in binary terms which translates to4 bits. If for example each row represented 32 sectors, then the 5 LSBsof the LBA sent by the host would be masked.

Once the row 1040 in the SPM RAM block 548 has been addressed, the valuein the virtual PBA field 1036 for the row 1040 is retrieved, which inthis case is ‘00’. ‘00’ is then used as the pointer to the blocks storedwithin the flash memory devices. That is, in this example, block 0, orthe block 1000 (on the left-hand side of FIG. 24) is addressed. But toget to the sector that was intended to be read, the 4 bits that wereinitially masked from the LBA value sent by the host, are used tospecifically address sector ‘5’ (not shown), which is the sixth sector,within the block 1040. The data stored in the data field 1052 of sector5 (not shown) is then retrieved or read. Next, the ECC field 1014 ofthat same sector is read.

The LBA location 1020 should have the value ‘00’, which is the sameaddress value that is stored in the virtual PBA field 1036 of the row1040 of table 700. This is intended for identifying the block 1000 inthe flash memory devices as block ‘00’ during the power-up routine, toupdate the space manager. Although, the LBA location 1020 does notrepresent the LBA value sent by the host as noted above. To avoid suchconfusion, the value in location 1020 may be referred to as a ‘cluster’address rather than an LBA address.

To illustrate another example in the context of a write operation, ifthe host commands the controller 506 to write to LBA ‘17’ (in decimalnotation), the controller masks the LSBs of the hexadecimal notation of‘17’ (which is ‘11’). The masked version of ‘17’ is ‘1’ in hexadecimalnotation. Thus, the row 1042 is addressed in table 700 and a the addressof a free block, as found by the space manager block 544, is placed inthe virtual PBA field 1036 of the row 1042. In this case, block 2 isfound as the next free block. Within the flash memory devices, block 2,which is the block 1002, is addressed. The sector where information isactually written into is sector 1 of the block 1002 (the second sectorin that block) because the 4 LSBs of the LBA value ‘11’ sent by host.The data and ECC are then written into the sector 1 of block 1002.

If the preferred embodiment example of FIG. 24 is used with theembodiment discussed with reference to FIG. 23, the LBA (or cluster)address is written in two places within each of the blocks.

Although the present invention has been described in terms of specificembodiments, it is anticipated that alterations and modificationsthereof will no doubt become apparent to those skilled in the art. It istherefore intended that the following claims be interpreted as coveringall such alterations and modification as fall within the true spirit andscope of the invention.

What is claimed is:
 1. A storage device comprising: a nonvolatile memorycoupled to a host processor for storing information identified by alogical block address (LBA) assigned by the host processor, saidnonvolatile memory being organized in blocks of numbered rows ofinformation storage sites, at least a portion of each said block beingidentified by a physical block address (PBA); a memory device operativeto store a table including a plurality of storage sites, eachaddressable by a particular LBA, and each of which is associated with aparticular PBA identifying a particular block within said nonvolatilememory in which information corresponding to a particular LBA is, or isto be, stored in one or more of the rows thereof; and means associatedwith said memory device for accessing a block in said nonvolatile memoryidentified by a particular PBA in response to receipt from the hostprocessor of a corresponding LBA, said associated means accesses atleast a portion of a particular PBA to read data from, or to write datainto the accessed block, said associated means writes the identifyingLBA into two different locations within said accessed block, and uponaccessing of any block having data stored therein, said associated meanscompares the LBAs written into the two different locations within theblock, and if the LBAs match, said associated means determines that theblock is valid for accessing thereof.
 2. A storage device as recited inclaim 1 wherein if the LBAs do not match, said associated means beingoperative to erase the block prior to re-use.
 3. A storage device asrecited in claim 1 wherein each block includes a defect flag that ifset, prevents the block from being re-used even if the LBAs match.
 4. Ina storage device including a host having a host processor, a nonvolatilememory coupled to said host for storing digital information identifiedby a logical block address (LBA) assigned by the host processor, andincluding data, and a set of flags, said nonvolatile memory beingorganized in blocks of numbered rows of information storage sites, atleast a portion of each said block being identified by a physical blockaddress (PBA), and a memory device for storing a table of informationfor translating LBAs into corresponding PBAs identifying particularblocks within said nonvolatile memory and in which informationcorresponding to a particular LBA is, or is to be, stored in one or moreof the rows thereof, a process of managing the storage of information insaid nonvolatile memory comprising: receiving information to be stored,said information being identified by a LBA assigned by the hostprocessor; determining an available block in said nonvolatile memoryidentified by a particular PBA and available for storing saidinformation; storing the PBA of the available block into a location insaid memory device addressable by a particular LBA; storing theinformation in the block of said nonvolatile memory identified by saidPBA; storing said LBA in a first location in said block along with saidinformation; storing said LBA in a second location in said block; uponpower-up of said storage device, comparing the LBA stored in said firstlocation of said block to the LBA stored in said second location of saidblock; and if a match is found, continuing to use the block forinformation storage.
 5. In a storage device as recited in claim 4,further including the step of setting a “used” flag in said block.
 6. Ina storage device as recited in claim 4 wherein if a match is found and acorresponding “defect” flag is not set, determining that the data is notdefective and continuing to use the block for information storage.
 7. Ina storage device as recited in claim 6 wherein if the LBA stored in saidfirst location of said block does not match the LBA stored in saidsecond location of said block and no “defect” flag is set, thendetermining that the block is not defective and erasing the block beforere-use.
 8. A process of managing the storage of digital information in astorage device including a nonvolatile memory so that, upon power-up,defective data can be quickly located, comprising: receiving informationidentified by a logical block address (LBA); determining an availableblock or portion of a block in said nonvolatile memory for storing theinformation, said available block or portion thereof being identified bya physical block address (PBA); storing the PBA into a location in amemory device addressable by said LBA; storing the information in theblock or portion of the block of said nonvolatile memory identified bysaid PBA; storing said LBA in a first location in said block; storingsaid LBA in a second location in said block; upon power-up of saidstorage device; and comparing the LBA stored in said first location tothe LBA stored in the second location, and if a match is found,continuing to use the block for information storage.
 9. A process ofmanaging the storage of digital information as recited in claim 8further including the step of setting a “used” flag.
 10. A process ofmanaging the storage of digital information as recited in claim 8wherein during the comparing step, if a match is found and no “defect”flag is set, determining that the data is not defective.
 11. A processof managing the storage of digital information as recited in claim 8wherein if the LBA stored in said first location does not match the LBAstored in said second location, and no defect flag is set, thendetermining that the block is not defective and erasing the block beforeits re-use.
 12. A process of managing the storage of digital informationas recited in claim 8 wherein, upon power-up of said storage device,each said PBA in said nonvolatile memory is scanned and stored in avolatile memory in a location corresponding to a particular LBA.
 13. Ina storage device including a host having a host processor, a nonvolatilememory coupled to said host for storing digital information identifiedby a logical block address (LBA) assigned by the host processor, andincluding data, and a set of flags, said nonvolatile memory beingorganized in blocks of numbered rows of information storage sites, atleast a portion of each said block being identified by a physical blockaddress (PBA), and a memory device for storing a table of informationfor translating LBAs is into corresponding PBAs identifying particularblocks within said nonvolatile memory and in which informationcorresponding to a particular LBA is, or is to be, stored in one or moreof the rows thereof, a process of managing the storage of information insaid nonvolatile memory comprising: receiving information to be stored,said information being identified by a LBA assigned by the hostprocessor; determining an available block in said nonvolatile memoryidentified by a particular PBA and available for storing saidinformation; storing the PBA of the available block into a location insaid memory device addressable by a particular LBA; storing theinformation in the block of said nonvolatile memory identified by saidPBA; storing a first flag in a first location in said block with saidinformation; and storing a second LBA in a second location in saidblock, said first flag or second LBA for validating that said block iscompletely written.
 14. A process of managing the storage of digitalinformation in a storage device including a nonvolatile memory so that,upon power-up, defective data can be quickly located, comprising:receiving information identified by a logical block address (LBA);determining an available block or portion of a block in said nonvolatilememory for storing the information, said available block or portionthereof being identified by a physical block address (PBA); storing thePBA into a location in a memory device addressable by said LBA; storingthe information in the block or portion of the block of said nonvolatilememory identified by said PBA; storing a first flag in a first locationin said block; storing a second LBA in a second location in said block;said first flag or second LBA for validating that said block iscompletely written.